/*
 * @Author: hgy
 * @Date: 2022-10-13 14:10:00
 * @LastEditTime: 2022-10-14 14:52:52
 * @LastEditors: hgy
 * @Description:
 * @FilePath: \jep-training-trinity-group\briup-ui\src\store\modules\account.js
 * 别乱动！
 */
import {
  CustomerAccount,
  EmployeeAccount,
  SystemAccount,
  getId
} from '@/api/account'

export default {
  namespaced: true,
  state: {
    CustomerAccount: [],
    EmployeeAccount: [],
    SystemAccount: [],
    Id: []
  },
  mutations: {
    SET_CUSTOMERACCOUNT(state, payload) {
      state.CustomerAccount = payload
    },
    SET_EMPLOYEEACCOUNT(state, payload) {
      state.EmployeeAccount = payload
    },
    SET_SYSTEMACCOUNT(state, payload) {
      state.SystemAccount = payload
    },
    SET_Id(state, payload) {
      state.Id = payload
    }
  },
  actions: {
    async CustomerAccounts({ commit }, params) {
      const res = await CustomerAccount(params)
      // console.log(res, "顾客账单");
      commit('SET_CUSTOMERACCOUNT', res.data)
    },
    async EmployeeAccounts({ commit }, params) {
      const res = await EmployeeAccount(params)
      // console.log(res, "员工账单");
      commit('SET_EMPLOYEEACCOUNT', res.data)
    },
    async SystemAccounts({ commit }, params) {
      const res = await SystemAccount(params)
      // console.log(res, "系统账单");
      commit('SET_SYSTEMACCOUNT', res.data)
    },
    async getIds({ commit }, params) {
      const res = await getId(params)
      // console.log(res, "编号");
      commit('SET_Id', res.data.list)
    }
  }
}
